# 字符串分割
def split_set(input_set, chunk_size):
    if chunk_size <= 0:
        raise ValueError("chunk_size 必须为正整数")
    lst = list(input_set)
    return [set(lst[i:i + chunk_size]) for i in range(0, len(lst), chunk_size)]

input_str = input("需要去重的ID集合：")
separator = input("分隔符：")
need_split = input("是否需要分组y/n：")
if need_split == 'y':
    batch_size_str = input("分组大小：")
# 字符串分隔
s = input_str.split(separator,-1)
# 声明空集合
distinct_set = set()
# 将分隔好的字符串类，转为int型
for item in s:
    distinct_set.add(int(item))
print("去重后的数组长度是：{}，详情：{}".format(len(distinct_set),distinct_set))
# 分组
i=1
if need_split == 'y':
    for item in split_set(distinct_set,int(batch_size_str)):
        print(','.join(map(str,item)))
        print("--第{}组--".format(i))
        i += 1
else:
    final_list = list(distinct_set)
    print(','.join(map(str,final_list)))